<?php


class Silk_Zgb_Block_Adminhtml_Inventory_New extends Mage_Adminhtml_Block_Widget{
	public function __construct()
	{
		parent::__construct();
		$this->setTemplate('zgb/inventory/new.phtml');
	}
	public function K3cloud_data(){
		$websiteId = Mage::helper("qslb")->_getwebsiteId();
		$cookie_jar = tempnam('./tmp','CloudSession');
		$webpost = new Webpost();
		$result = $webpost->invoke_login($cookie_jar);
		$result = json_decode($result,true);
		header("Content-type: text/html; charset=utf-8");
		if($result['LoginResultType'] == 1 || $result['LoginResultType'] == -5){
			//其它入库用途
			$FQTRK_TYPE_data = array(
					'0'=>array(
							"FormId"       => 'BOS_ASSISTANTDATA_DETAIL',
							"TopRowCount"  => 0,
							"FilterString" => "Fid.Fnumber = 'QTRKYT'" ,
							"OrderString"  => "" ,
							"FieldKeys"    => "FNumber,FDataValue" ,
					)
			);
			$post_FQTRK_TYPE = $webpost->create_postdata($FQTRK_TYPE_data);
			$FQTRK_TYPE_all = $webpost->invoke_searchlist($post_FQTRK_TYPE,$cookie_jar);
			$FQTRK_TYPE_all = json_decode($FQTRK_TYPE_all);
			$result['FQTRK_TYPE_in'] = $FQTRK_TYPE_all->Result->Result;
			//其它出库用途
			$FQTRK_TYPE_data = array(
					'0'=>array(
							"FormId"       => 'BOS_ASSISTANTDATA_DETAIL',
							"TopRowCount"  => 0,
							"FilterString" => "Fid.Fnumber = 'QTCKYT'" ,
							"OrderString"  => "" ,
							"FieldKeys"    => "FNumber,FDataValue" ,
					)
			);
			$post_FQTRK_TYPE = $webpost->create_postdata($FQTRK_TYPE_data);
			$FQTRK_TYPE_all = $webpost->invoke_searchlist($post_FQTRK_TYPE,$cookie_jar);
			$FQTRK_TYPE_all = json_decode($FQTRK_TYPE_all);
			$result['FQTRK_TYPE_out'] = $FQTRK_TYPE_all->Result->Result;
			//供应商
			$FSUPPLIERID_data = array(
					'0'=>array(
							"FormId"       => 'BD_Supplier',
							"TopRowCount"  => 0,
							"FilterString" => 'FUSEORGID.Fnumber='.$websiteId.'' ,
							"OrderString"  => "" ,
							"FieldKeys"    => "FNumber,FName" ,
					)
			);
			$post_FSUPPLIERID = $webpost->create_postdata($FSUPPLIERID_data);
			$FSUPPLIERID_all = $webpost->invoke_searchlist($post_FSUPPLIERID,$cookie_jar);
			$FSUPPLIERID_all = json_decode($FSUPPLIERID_all);
			$result['FSUPPLIERID'] = $FSUPPLIERID_all->Result->Result;
			//验收员FACCEPTANCE
			$FACCEPTANCE_data = array(
					'0'=>array(
							"FormId"       => 'BD_Empinfo',
							"TopRowCount"  => 0,
							"FilterString" => 'FUSEORGID.Fnumber='.$websiteId.'' ,
							"OrderString"  => "" ,
							"FieldKeys"    => "FNumber,FName" ,
					)
			);
			$post_FACCEPTANCE = $webpost->create_postdata($FACCEPTANCE_data);
			$FACCEPTANCE_all = $webpost->invoke_searchlist($post_FACCEPTANCE,$cookie_jar);
			$FACCEPTANCE_all = json_decode($FACCEPTANCE_all);
			$result['FACCEPTANCE'] = $FACCEPTANCE_all->Result->Result;
			//部门
			$FDEPTID_data1 = array(
					'0'=>array(
							"FormId"       => 'BD_Department',
							"TopRowCount"  => 0,
							"FilterString" => 'FUSEORGID.Fnumber='.$websiteId.'' ,
							"OrderString"  => "" ,
							"FieldKeys"    => "FNumber,FName" ,
					)
			);
			$post_FDEPTID = $webpost->create_postdata($FDEPTID_data1);
			$FDEPTID_all = $webpost->invoke_searchlist($post_FDEPTID,$cookie_jar);
			$FDEPTID_all = json_decode($FDEPTID_all);
			$result['FDEPTID'] = $FDEPTID_all->Result->Result;
	
	
		}
		return $result;
	}
}